home *** CD-ROM | disk | FTP | other *** search
/ PC Player 2004 May / pc player 2004-05.iso / Demos / FarCry / Data1.cab / _4D4FF7D893324077B449FC44E3512230 < prev    next >
Encoding:
Text File  |  2004-01-06  |  4.2 KB  |  110 lines

  1. -------------------------------------------------
  2. --       Created By:     Sten Huebler
  3. --       Description:     pecari behaviour
  4. --------------------------
  5. --    last modified:    24-10-2002 
  6.  
  7. AIBehaviour.Pig = {
  8.     Name = "Pig",
  9.     
  10.     
  11.     -- SYSTEM EVENTS            -----
  12.     ---------------------------------------------
  13.     OnSpawn = function( self, entity )
  14.         -- called when enemy spawned or reset
  15.  
  16.         AI:CreateGoalPipe("pig_wander");
  17.         AI:PushGoal("pig_wander","signal",0,1,"DO_COOL_ANIMATION",0);
  18.         AI:PushGoal("pig_wander","locate",0,"hidepoint");
  19.         AI:PushGoal("pig_wander","acqtarget",0,"");
  20.         AI:PushGoal("pig_wander","timeout",1,1,2);
  21.         AI:PushGoal("pig_wander","approach",1,0.5);
  22.         AI:PushGoal("pig_wander","timeout",1,0,1);
  23.         AI:PushGoal("pig_wander","approach",1,0.5);
  24.         AI:PushGoal("pig_wander","timeout",1,0,1);
  25.         AI:PushGoal("pig_wander","signal",0,1,"DO_SOMETHING_INTERESTING",0);
  26.         AI:PushGoal("pig_wander","timeout",1,1,2);
  27.  
  28.         AI:CreateGoalPipe("pig_scared_hide");
  29.         AI:PushGoal("pig_scared_hide","run",0,1);
  30.         AI:PushGoal("pig_scared_hide","hide",1,20,HM_FARTHEST_FROM_TARGET,1);
  31.         AI:PushGoal("pig_scared_hide","run",0,0);
  32.         AI:PushGoal("pig_scared_hide","timeout",1,0,1);
  33.         AI:PushGoal("pig_scared_hide","signal",0,1,"APPROACH_TARGET",0);
  34.     
  35.         AI:CreateGoalPipe("pig_cautious_sniff");
  36.         AI:PushGoal("pig_cautious_sniff","timeout",1,1,2);
  37.         AI:PushGoal("pig_cautious_sniff","signal",0,1,"WONDER_ABOUT_SOMETHING",0);
  38.         AI:PushGoal("pig_cautious_sniff","hide",1,20,HM_FARTHEST_FROM_TARGET,1);
  39.         AI:PushGoal("pig_cautious_sniff","signal",0,1,"WONDER_ABOUT_SOMETHING",0);
  40.  
  41.         AI:CreateGoalPipe("pig_cautious_approach");
  42.         AI:PushGoal("pig_cautious_approach","timeout",1,0,1);
  43.         AI:PushGoal("pig_cautious_approach","approach",1,1);
  44.         AI:PushGoal("pig_cautious_approach","timeout",1,0,1);
  45.         AI:PushGoal("pig_cautious_approach","signal",0,1,"WONDER_ABOUT_SOMETHING",0);
  46.         AI:PushGoal("pig_cautious_approach","timeout",1,0,1);
  47.         AI:PushGoal("pig_cautious_approach","signal",0,1,"WANDER_AROUND",0);
  48.  
  49.         self:WANDER_AROUND(entity);
  50.     end,
  51.     ---------------------------------------------
  52.     OnNoTarget = function( self, entity )
  53.         -- called when the enemy stops having an attention target
  54.         self:WANDER_AROUND(entity);
  55.     end,
  56.     ---------------------------------------------
  57.     OnPlayerSeen = function( self, entity, fDistance )
  58.         -- called when the enemy sees a living player
  59.         entity:SelectPipe(0,"pig_scared_hide");
  60.     end,
  61.     ---------------------------------------------
  62.     OnInterestingSoundHeard = function( self, entity )
  63.         -- called when the enemy hears an interesting sound
  64.         entity:SelectPipe(0,"pig_cautious_approach");
  65.     end,
  66.     ---------------------------------------------
  67.     OnThreateningSoundHeard = function( self, entity )
  68.         -- called when the enemy hears a scary sound
  69.         entity:SelectPipe(0,"pig_scared_hide");
  70.     end,
  71.     ---------------------------------------------
  72.     OnGroupMemberDied = function( self, entity )
  73.         entity:SelectPipe(0,"pig_scared_hide");
  74.     end,
  75.     ---------------------------------------------
  76.     OnReceivingDamage = function ( self, entity, sender)
  77.         -- called when the enemy is damaged
  78.         entity:SelectPipe(0,"pig_scared_hide");
  79.     end,
  80.     ---------------------------------------------
  81.     OnBulletRain = function ( self, entity, sender)
  82.         -- called when the enemy is damaged
  83.         entity:SelectPipe(0,"pig_scared_hide");
  84.     end,
  85.  
  86.  
  87.     WONDER_ABOUT_SOMETHING = function ( self, entity, sender)
  88.         -- play some animation that is not related to anything
  89.         entity:InsertAnimationPipe("pecari_sniff");
  90.     end,
  91.     ---------------------------------------------------
  92.     WANDER_AROUND = function ( self, entity, sender)
  93.         entity:SelectPipe(0,"pig_wander");        
  94.     end,
  95.     ---------------------------------------------------
  96.     DO_COOL_ANIMATION = function ( self, entity, sender)
  97.         -- play some animation that is not related to anything
  98.     end,
  99.     ---------------------------------------------------
  100.     DO_SOMETHING_INTERESTING = function ( self, entity, sender)
  101.         -- play sniffing animation, or peeing animation or whatever
  102.         entity:InsertAnimationPipe("pecari_sniff");
  103.     end,
  104.  
  105.     APPROACH_TARGET = function( self, entity, sender )
  106.         -- called when the enemy hears an interesting sound
  107.         entity:SelectPipe(0,"pig_cautious_approach");
  108.     end,
  109.  
  110. }